package com.wiscamp.ninechapters.problems.enums;

/**
 * 练习任务状态枚举
 */
public enum TaskStatus {
    NOT_COMPLETED(143001, "未完成"),

    COMPLETED(143002, "已完成"),

    ABANDON(143099, "已放弃");

    private final int value;

    private final String name;

    TaskStatus(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public int getValue() {
        return value;
    }

    public static TaskStatus valueOf(int value) {
        return switch (value) {
            case 143001 -> TaskStatus.NOT_COMPLETED;
            case 143002 -> TaskStatus.COMPLETED;
            case 143099 -> TaskStatus.ABANDON;
            default -> null;
        };
    }
}
